package com.shenmazong.controller;

import com.github.pagehelper.PageInfo;
import com.shenmazong.pojo.TbTaskGrade;
import com.shenmazong.service.TbTaskGradeService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.ListParamVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 成绩
 */
@RestController
@RequestMapping("/TaskGrade")
public class TbTaskGradeController {
    @Autowired
    TbTaskGradeService tbTaskGradeService;

    /**
     * 列表
     * @param listParamVo
     * @return
     */
    @PostMapping("/findTbTaskGradeList")
    public ResultResponse findTbTaskGradeList(@RequestBody ListParamVo listParamVo){
        Integer current = listParamVo.getCurrent();
        Integer size = listParamVo.getSize();
        Object taskGrade = listParamVo.getParamMap().get("taskGrade");
        PageInfo pageInfo =tbTaskGradeService.findTbTaskGradeList(current,size,taskGrade);
        return ResultResponse.SUCCESS(pageInfo);
    }

    /**
     * 添加
     * @param tbTaskGrade
     * @return
     */
    @PostMapping("/saveTbTaskGrade")
    public ResultResponse saveTbTaskGrade(@RequestBody TbTaskGrade tbTaskGrade){
        return tbTaskGradeService.saveTbTaskGrade(tbTaskGrade);
    }

    /**
     * 回显
     * @param tbTaskGrade
     * @return
     */
    @PostMapping("/echoTbTaskGrade")
    public ResultResponse echoTbTaskGrade(@RequestBody TbTaskGrade tbTaskGrade){
        return tbTaskGradeService.echoTbTaskGrade(tbTaskGrade);
    }

    /**
     * 修改
     * @param tbTaskGrade
     * @return
     */
    @PostMapping("/updateTbTaskGrade")
    public ResultResponse updateTbTaskGrade(@RequestBody TbTaskGrade tbTaskGrade){
        return tbTaskGradeService.updateTbTaskGrade(tbTaskGrade);
    }

    /**
     * 删除
     * @param tbTaskGrade
     * @return
     */
    @PostMapping("/delTbTaskGrade")
    public ResultResponse delTbTaskGrade(@RequestBody TbTaskGrade tbTaskGrade){
        return tbTaskGradeService.delTbTaskGrade(tbTaskGrade);
    }


}
